package com.aurora.app.entity;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.aurora.app.enums.HelpCategory;
import com.aurora.app.enums.HelpOrderState;
import com.aurora.app.enums.PayCatatory;
import com.aurora.base.entity.BaseEntity;

@Entity
@Table(name="tb_help")
public class Help extends BaseEntity {
	//发表用户
	private User user;
	//过时时间
	private Date outOfTime;
	//支付金额
	private BigDecimal money;
	//支付其他物品描述
	private String otherPay;
	//支付种类
	private PayCatatory payCatatory;
	//标题
	private String title;
	//任务描述
	private String task;
	//帮帮类型
	private HelpCategory helpCategory;
	//经纬度
	private Location location;
	
	@ManyToOne(cascade = {CascadeType.REFRESH}, optional = false, fetch = FetchType.LAZY)
	@JoinColumn(name = "f_location_id")
	public Location getLocation() {
		return location;
	}
	public void setLocation(Location location) {
		this.location = location;
	}
	@Column(name="f_money")
	public BigDecimal getMoney() {
		return money;
	}
	public void setMoney(BigDecimal money) {
		this.money = money;
	}
	
	@ManyToOne(cascade = {CascadeType.REFRESH}, optional = false, fetch = FetchType.LAZY)
	@JoinColumn(name = "f_user_id")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="f_out_of_time")
	public Date getOutOfTime() {
		return outOfTime;
	}
	public void setOutOfTime(Date outOfTime) {
		this.outOfTime = outOfTime;
	}
	@Column(name="f_task")
	public String getTask() {
		return task;
	}
	public void setTask(String task) {
		this.task = task;
	}
	
	@Enumerated(EnumType.ORDINAL)
	@Column(name = "f_helpCategory")
	public HelpCategory getHelpCategory() {
		return helpCategory;
	}
	public void setHelpCategory(HelpCategory helpCategory) {
		this.helpCategory = helpCategory;
	}
	
	@Column(name="f_other_pay")
	public String getOtherPay() {
		return otherPay;
	}
	public void setOtherPay(String otherPay) {
		this.otherPay = otherPay;
	}
	
	@Enumerated(EnumType.ORDINAL)
	@Column(name = "f_pay_category")
	public PayCatatory getPayCatatory() {
		return payCatatory;
	}
	public void setPayCatatory(PayCatatory payCatatory) {
		this.payCatatory = payCatatory;
	}
	
	@Column(name="f_title")
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
}
